import { request } from '../utils/request';
import type { LoginParams, RegisterParams, LoginResponse } from '../types/auth';

export const authApi = {
  // 登录
  login: (data: LoginParams) => 
    request.post<LoginResponse>('/api/auth/login', data),

  // 注册
  register: (data: RegisterParams) => 
    request.post<void>('/api/auth/register', data),

  // 登出
  logout: () => 
    request.post<void>('/api/auth/logout'),

  // 获取当前用户信息
  getCurrentUser: () => 
    request.get<LoginResponse>('/api/auth/me'),

  // 刷新token
  refreshToken: () => 
    request.post<{ token: string }>('/api/auth/refresh'),
}; 